import apiConfig from "@/utils/apiConfig"
import aws_cfg from "@/utils/aws"
const gameList = {
    index: true,
    border: true,
    stripe: true,
    menu:true,
    menuAlign: 'center',
    menuWidth: 160,
    loadingText: "加载中...",
    loadingSpinner: "svg",
    loadingSvgViewBox: "-10, -10, 50, 50",
    loadingBackground: "rgba(122, 122, 122, 0.6)",
    labelWidth: 120,
    column: [
        {
            label: "ID",
            prop: "id",
            display: false,
            width: "55"
        },
        {
            label: "游戏编码",
            prop: "gameCode",
            span: 12,
            minWidth: 120,
            overHidden: true,
            search: true,
            searchSlot: true,
            rules: [
                {
                    required: true,
                    message: "请输入游戏编码",
                    trigger: "blur"
                }
            ]
        },
        {
            label: "游戏名称",
            prop: "name",
            span: 12,
            minWidth: 120,
            overHidden: true,
            search: true,
            searchSlot: true,
            rules: [
                {
                    required: true,
                    message: "请输入游戏名称",
                    trigger: "blur"
                }
            ]
        },
        {
            label: "游戏类型",
            prop: "gameType",
            span: 12,
            search: true,
            searchSlot: true,
            minWidth: 100,
            searchType: "select",
            type: 'select',
            dicData: [
                {
                    label: 'Slot',
                    value: 1
                },
                {
                    label: 'Spin',
                    value: 5
                },
                {
                    label: 'Live',
                    value: 2
                },
                {
                    label: 'Poker',
                    value: 3
                },
                {
                    label: 'Mini',
                    value: 4
                },
            ],
            rules: [
                {
                    required: true,
                    message: "请选择游戏类型",
                    trigger: "change"
                }
            ]
        },
        {
            label: "所属公司",
            prop: "company",
            span: 12,
            search: true,
            searchSlot: true,
            minWidth: 100,
            searchType: "select",
            type: 'select',
            dicMethod: 'POST',
            dicUrl: apiConfig.baseURL + '/admin/v1/company/list',
            dicQuery: {
                page: 1,
                pageSize: 10,
            },
            dicHeaders: {
                Authorization: `${localStorage.getItem('token')}` || ''
            },
            dicFormatter: (res) => {
                let arr = []
                res.data.list.map(item => {
                    arr.push({
                        label: item.name,
                        value: item.name
                    })
                })
                return arr
            },
            rules: [
                {
                    required: true,
                    message: "请选择所属公司",
                    trigger: "change"
                }
            ]
        },
        {
            label: "货币单位",
            value: 'GHS',
            prop: "currency",
            search: false,
            minWidth: 100,
            searchType: "select",
            type: 'select',
            dicData: [
                {
                    label: 'GHS',
                    value: 'GHS'
                },
            ],
            rules: [
                {
                    required: true,
                    message: "请选择货币单位",
                    trigger: "change"
                }
            ]
        },
        {
            label: "是否推荐",
            prop: "isRecommend",
            span: 12,
            search: true,
            searchSlot: true,
            minWidth: 100,
            searchType: "select",
            type: 'select',
            dicData: [
                {
                    label: '否',
                    value: 0
                },
                {
                    label: '是',
                    value: 1
                },
            ],
            formatter: (row, value, column) => {
                return row.isRecommend ? '是' : '否'
            },
            rules: [
                {
                    required: true,
                    message: "请选择是否推荐",
                    trigger: "change"
                }
            ]
        },
        {
            label: "是否热门",
            prop: "isHot",
            span: 12,
            search: true,
            searchSlot: true,
            minWidth: 100,
            searchType: "select",
            type: 'select',
            dicData: [
                {
                    label: '否',
                    value: 0
                },
                {
                    label: '是',
                    value: 1
                },
            ],
            formatter: (row, value, column) => {
                return row.isHot ? '是' : '否'
            },
            rules: [
                {
                    required: true,
                    message: "请选择是否热门",
                    trigger: "change"
                }
            ]
        },
        {
            label: "状态",
            prop: "status",
            span: 12,
            search: true,
            searchSlot: true,
            minWidth: 80,
            searchType: "select",
            type: 'select',
            dicData: [
                {
                    label: '下架',
                    value: 0
                },
                {
                    label: '上架',
                    value: 1
                },
                {
                    label: '维护',
                    value: 2
                },
            ],
            formatter: (row, value, column) => {
                return row.status ? (row.status == 2 ? '维护' : '上架') : '下架'
            },
            rules: [
                {
                    required: true,
                    message: "请选择状态",
                    trigger: "change"
                }
            ]
        },
        {
            label: '游戏封面',
            prop: 'icon',
            span: 12,
            minWidth: 100,
            type: 'upload',
            fileType: 'img',
            limit: 1,
            listType: 'picture-img',
            oss: 's3',
            rules: [
                {
                    required: true,
                    message: "请上传游戏封面",
                    trigger: "change"
                }
            ]
        },
        {
            label: "排序",
            prop: 'sort',
            span: 12,
            type: "number",
            minWidth: 100,
        },
        {
            label: "游戏链接",
            prop: 'clientUrl',
            span: 12,
            minWidth: 100,
            overHidden: true
        }
    ],
}

export default gameList